<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "" "">
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:w="http://www.apusic.com/jsf/widget" xmlns:layout="http://www.apusic.com/jsf/layout"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:ajax="http://www.apusic.com/jsf/ajax"
	renderKitId="AJAX">
	<w:head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<w:stylesheet src="/css/kmp4.css" type="text/css"></w:stylesheet>
		<script type="text/javascript">
		//<![CDATA[
			function formatFloat(src, pos){
    			return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
    		}
			function transLength(v, m , r, rIndex){
				if(1024*1024*10>v)
					return formatFloat(v/1024,2)+'KB';
				return formatFloat(v/1024/1024,2)+'MB';
			}
			function downloadAttach(){
				var sid = attachmentComponent.getSelectionModel().getSelected().get('id');
				window.location.href='#{facesContext.externalContext.requestContextPath}/downloadAttachment?id='+sid;
			}
		//]]>
		</script>
	</w:head>
	<w:page title="附件">
		<layout:panel border="false" autoHeight="true" autoWidth="true" header="false"
			styleClass="k4-view-window">
			<w:dataGrid id="attachments" paged="false" showRowNumber="true" jsvar="attachmentComponent"
				border="false" ondblclick="javascript:downloadAttach();" singleSelect="true"
				autoExpandColumn="2" autoHeight="true">
				<w:outputColumn header="ID" id="id" hidden="true"></w:outputColumn>
				<w:outputColumn header="文件名" id="fileName" wrap="true"></w:outputColumn>
				<w:outputColumn header="大小" id="length" width="100" clientFormatter="transLength"></w:outputColumn>
				<w:outputColumn header="上传时间" id="createTime" width="85" converter="dateFormatter"></w:outputColumn>
				<w:outputColumn header="上传人" id="author" width="70"></w:outputColumn>
			</w:dataGrid>
		</layout:panel>
	</w:page>
</f:view>